<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>fullcalendar timeline</title>
    <link rel="stylesheet" href="../packages/core/main.min.css">
    <link rel="stylesheet" href="../packages/timeline/main.min.css">
    <link rel="stylesheet" href="../packages/resource-timeline/main.min.css">
    <style>
        body {
            margin: 40px 10px;
            padding: 0;
            font-family: Arial, Helvetica Neue, Helvetica, sans-serif;
            font-size: 14px;
        }
        #calendar {
            max-width: 900px;
            margin: 0 auto;
        }
    </style>
</head>
<body>
<div id='calendar'></div>
</body>
<script src="https://cdn.bootcss.com/jquery/3.4.1/jquery.min.js"></script>
<script src="../packages/core/main.min.js"></script>
<script src="../packages/interaction/main.min.js"></script>
<script src="../packages/timeline/main.min.js"></script>
<script src="../packages/resource-common/main.min.js"></script>
<script src="../packages/resource-timeline/main.min.js"></script>
<script>
    $(function() {
        var resourceList = [],
            eventList = [],
            calendarEl = document.getElementById('calendar');
        getResource();
        getEvent();

        setTimeout(function() {
            var calendar = new FullCalendar.Calendar(calendarEl, {
                plugins: [ 'interaction', 'resourceTimeline' ],
                timeZone: 'UTC',
                defaultView: 'resourceTimelineDay',
                aspectRatio: 1.5,
                header: {
                    left: 'prev,next',
                    center: 'title',
                    right: 'resourceTimelineDay,resourceTimelineWeek,resourceTimelineMonth'
                },
                editable: true,
                resourceLabelText: 'Rooms',
                resources: resourceList,
                events: eventList,
            });

            calendar.render();

        }, 200);

        function getResource() {
            return $.getJSON('./json/recources.json', function(res) {
                resourceList = res;
            });
        }

        function getEvent() {
            return $.get('./json/events.json', function(res) {
                eventList = res;
            })
        }

    })
</script>
</html>